<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" href="css/style.css" type="text/css"/>
        <title></title>
    </head>
    <body>
        <div id="wrapper">
            <?php include 'template/header.php' ?>
            <div id="main">
                <?php include'template/sidebar.php' ?>
                <div id="content">
                    <?php
                    if (isset($_POST['search'])) {
                        $name = $_POST['keySearch'];
                        ?>
                        <div id="products">
                            <div class="paging">
                                <div class="first">
                                    <h2>kết quả tìm kiếm</h2>
                                </div>
                            </div><!---END #paging--->
                            <?php
                            include 'Connect_db.php';
                            Connect_db();
                            $query = "SELECT * FROM product WHERE pro_name like '%$name%'";
                            $result = mysql_query($query, $conn);
                            $count = mysql_num_rows($result);
                            if ($count > 0) {
                                ?>
                                <p class="product-title" style="color:red; font-weight: bold; margin-top: 10px; font-family: arial;font-size: 14px;">Có tất cả <?php echo $count ?> sản phẩm</p>
                                <?php
                                while ($row = mysql_fetch_assoc($result)) {
                                    ?>
                                    <div class="product">
                                        <div class="product-img"><a href="product-detail.php?pro_id=<?php echo $row['id'] ?>"><img src="public/templates/admin/<?php echo $row['pro_img']; ?>" alt="sp1"/></a></div>
                                        <div class="product-name"><a href="product-detail.php?pro_id=<?php echo $row['id'] ?>"><?php echo $row['pro_name'] ?></a></div>
                                        <div class="product-id"><p>Mã số:<?php echo $row['id'] ?></p></div>
                                        <div class="product-price-old"><strike>Giá cũ: <?php echo number_format($row['pro_price_old']) ?>đ</strike></div>
                                        <div class="product-price"><span>Giá mới: <?php echo number_format($row['pro_price']) ?>đ</span></div>
                                    </div><!---END .product-->
                                    <?php
                                }
                            } else {
                                ?>
                                <p class="product-title" style="color:red; font-weight: bold; margin-top: 10px;  font-family: arial;font-size: 14px;">Không tìm thấy sản phẩm nào</p>
                                <?php
                            }
                        }
                        ?>
                    </div>
                </div>
            </div>
            <?php include 'template/footer.php' ?>
        </div>
    </body>
</html>
